const db = require('../db/index')
// 获取课程章节列表的接口
exports.getChapterList = (req, res) => {
    const courseId = req.params.courseId;  // 从路由参数中获取课程ID
    const sql = 'SELECT * FROM chapters WHERE course_id = ?';

    db.query(sql, [courseId], (err, results) => {
        if (err) {
            return res.status(500).json({ error: err.message });
        }
        console.log(results)
        res.json(results);  // 返回章节列表
    });
};
